﻿@using FC.Data.ViewModels.Account

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - FeelingCoder 一个神奇的网站</title>
    <link href="~/Content/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="~/Content/FC.bootstrap.css" rel="stylesheet" />
    <link href="~/Content/Site.css" rel="stylesheet" type="text/css" />
    @RenderSection("Style", false)
</head>
<body>

    <header id="header">
        <nav class="navbar navbar-default navbar-fixed-top" style="height:60px;" role="navigation">
            <div class="container" style="margin-top:3px;">
                <div class="navbar-header" type="button">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    @Html.ActionLink("FeelingsCoder测评", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
                </div>
                <div class="navbar-collapse collapse">
                    <ul class="nav navbar-nav">
                        @*<li><a href="#"><span class=""></span>试题集</a></li>*@

                    </ul>
                    <ul class="nav navbar-nav navbar-right">
                        <li>
                            <a href="#" style="font-family:'黑体'">
                                <span id="city" style="margin-right:5px;"></span>
                                <span id="weather" style="margin-right:5px;"></span>
                                <span id="pm2_5" style="margin-right:5px;"></span>
                            </a>
                        </li>
                        @if (Session["User"] == null)
                        {
                        <li><a href="~/Account/Login" class="btn btn-default" style="margin-right: 10px; padding: 10px; margin-top:5px; width:100px"><span class="glyphicon glyphicon-user" style="margin-right: 5px;"></span> 登录 </a></li>
                        <li><a href="~/Account/Register" class="btn btn-default" style="padding: 10px; margin-top:5px; width:100px;"><span class="glyphicon glyphicon-plus" style="margin-right: 5px;"></span> 注册</a></li>
                        }
                        else
                        {
                            if ((Session["User"] as User).UserName == "admin")
                            {
                        <li><a href="~/Manager"><span class=""></span>管理</a></li>
                            }
                        <li><a href="~/Contests"><span class=""></span>试题集</a></li>
                        @*<li><a href="~/Blog"><span class=""></span>博客</a></li>
                            <li><a href="~/Code"><span class=""></span>代码库</a></li>*@
                        <li><a href="~/User"><span class="glyphicon glyphicon-user"></span> @(((User)Session["User"]).UserName)</a></li>
                        <li><a href="~/Account/Logout">注销</a></li>
                        }
                    </ul>
                </div>
            </div>
        </nav>
        @RenderSection("Header", false)
    </header>
    <div class="container" id="container">
        @RenderBody()
    </div>
    <footer id="footer" style="background-color:#F0F0F0; padding-bottom:30px;" hidden="hidden">
        <hr />
        <div class="container">
            <div class="row" style="height:150px;">
                <div class="col-lg-6">
                    <p>FeelingsCoder测评</p>
                    <p style="width:80%">FC测评不是真正的在线测试平台。它从其他普通在线测试平台抓取问题并模拟提交给其他在线测试平台，让你在没有测试数据的情况下也可以举办比赛。</p>
                    <div style="margin-top:15px;">
                        <span>联系我们：</span>
                        <a href="mailto:feelingscode@163.com" title="发送邮件给我们：feelingscode@163.com"><span class="glyphicon glyphicon-envelope"></span></a>
                        <a href="#" style="margin-left:10px;"><span class="glyphicon glyphicon-qrcode"></span></a>
                        <a href="/Home/LeaveMessage" style="margin-left:10px;" title="留言板"><span class="glyphicon glyphicon-pencil"></span></a>
                    </div>
                </div>
                <div class="col-md-2">
                    <h4>站点信息</h4>
                    <ul class="list-unstyled">
                        <li><a href="#">意见反馈</a></li>
                        <li><a href="#">免责声明</a></li>
                        <li><a href="#">加入我们</a></li>
                        <li><a href="#">关于我们</a></li>
                    </ul>
                </div>
                <div class="col-md-2">
                    <h4>友情链接</h4>
                    <ul class="list-unstyled">
                        <li><a href="http://www.weather.com.cn/">中国天气网</a></li>
                        <li><a href="http://pm25.in/">PM25.in</a></li>
                        <li><a href="http://glyphicons.com/">Glyphicon Halflings</a></li>
                    </ul>
                </div>
                <div class="col-md-2">
                    <h4>关注微信</h4>
                    <div>
                        <img src="~/Content/Images/Index/url.png" />
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <p>
                        &copy; 2016 - @DateTime.Now.Year - FeelingCoder 版权所有
                        <span style="margin-left:15px;">浙ICP备12002384号-4  增值电信业务经营许可证：浙B2-20140297浙公网安备 33020302000027号</span>
                    </p>
                </div>
            </div>
        </div>
    </footer>

    <script src="~/Scripts/jquery-3.1.1.min.js"></script>
    <script src="~/Scripts/jquery.validate.min.js"></script>
    <script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>
    <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>
    <script>
        $(function () {
            //设置窗口最小高度
            setContainerHeight();
            //设置重新调整窗口大小事件
            $(window).resize(function () {
                setContainerHeight();
            });

            $.ajax({
                url: '/Home/GetSimpleWeather',
                type: 'get',
                success: function (data) {
                    $("#city").html(data.CityName);
                    $("#weather").html(data.DayWeather + " " + data.DayTemperature + "/" + data.NightTemperature + " " + data.NightWeather);
                }
            });
            $.ajax({
                url: '/Home/GetPM2_5',
                type: 'get',
                success: function (data) {
                    if (data.pm2_5)
                        $("#pm2_5").html(data.quality + " " + data.pm2_5);
                }
            });
        })

        function setContainerHeight() {
            var containerHeight = parseInt($("#container").css("height"));
            var headerHeight = 60;
            var footerHeight = parseInt($("#footer").css("height"));
            var windowHeight = $(window).height();
            if (containerHeight < windowHeight - headerHeight - footerHeight - 20) {
                $("#container").css("height", (windowHeight - headerHeight - footerHeight) + "px")
            }
            $("#footer").removeAttr("hidden");
        }
    </script>
    @RenderSection("Script", false)

</body>
</html>